home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 February
/
EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso
/
enigma
/
earcd
/
sviluppo
/
svilupp2
/
whdload.lha
/
WHDLoad
/
src
/
oscar.asm
< prev
next >
Wrap
Assembly Source File
|
1996-07-03
|
3KB
|
167 lines
;*---------------------------------------------------------------------------
; :Program. oscar.asm
; :Contents. Slave for "Oscar"
; :Author. BJ
; :History. 20.05.96
; :Requires. -
; :Copyright. Public Domain
; :Language. 68000 Assembler
; :Translator. Barfly V1.131
; :To Do.
;---------------------------------------------------------------------------*
INCDIR Includes:
INCLUDE whdload.i
OUTPUT wart:oscar/oscar.slave
BOPT O+ OG+ ;enable optimizing
BOPT w4- ;disable 64k warnings
;======================================================================
.base SLAVE_HEADER ;ws_Security + ws_ID
dc.w 1 ;ws_Version
dc.w 0 ;ws_flags
.upchip dc.l $177000 ;ws_BaseMemSize
dc.l $300 ;ws_ExecInstall
dc.w .Start-.base ;ws_GameLoader
dc.w .dir-.base ;ws_CurrentDir
dc.w 0 ;ws_DontCache
.dir dc.b "data",0,0
;======================================================================
.Start ; A0 = resident loader
;======================================================================
lea (_resload,pc),a1
move.l a0,(a1) ;save for later using
move.l #CACRF_EnableI,d0 ;enable instruction cache
move.l d0,d1 ;mask
jsr (resload_SetCACR,a0)
lea _10,a0
move.l .freemem,a1
bsr _Load
lea .freemem,a0
add.l d0,(a0)
patch $400+$8b4e,.allocmem ;emulate this
nops ($2a8-$276)/2,$400+$276 ;disable some os-stuff
patch $400+$7b1a,_loader
IFD wmode
add.l #$99fc+$400-$9b64,$838+$400
ENDC
jmp $43e ;start the dance
.allocmem lea .freemem,a0 ;this emulates "exec.AllocMem"
move.l (a0),a1
add.l d0,(a0)
move.l (a0),d1
cmp.l (.upchip),d1
blo .1
illegal ;if basemem must increased
.1 move.l a1,a0
addq.l #7,d0
lsr.l #3,d0
.clr clr.l (a0)+
clr.l (a0)+
subq.l #1,d0
bne .clr
move.l a1,d0
rts
.freemem dc.l $400 ;start point of free memory
_10 dc.b "exe",0
EVEN
;--------------------------------
_loader
addq.l #4,a0 ;skip "df0:"
bsr _Load
bsr _kinit
moveq #0,d0 ;return code
rts
;--------------------------------
_kinit movem.l a0-a1,-(a7)
lea (_keyboard,pc),a1
cmp.l $68,a1
beq .q
lea (_realint68,pc),a0
move.l $68,(a0)
move.l a1,$68
.q movem.l (a7)+,a0-a1
rts
_realint68 dc.l 0
_keyboard move.l d0,-(a7)
move.b $bfec01,d0
ror.b #1,d0
not.b d0
; RAW-Key-Codes:
; ESC $45
; DEL $46
; F1..F10 $50..$59
; HELP $5f
cmp.b #$58,d0
bne .1
move.l (a7)+,d0
bra _debug ;coredump & quit
.1
cmp.b #$59,d0
beq _exit ;exit
cmp.b #$45,d0
beq _exit ;exit
move.l (a7)+,d0
move.l (_realint68),-(a7) ;enter orginal rou.
rts
;--------------------------------
_resload dc.l 0 ;address of resident loader
;--------------------------------
; IN: a0=name a1=loc
; OUT: d0=size
_Load movem.l d1/a0-a2,-(a7)
move.l (_resload),a2
jsr (resload_LoadFileDecrunch,a2)
tst.l d0
beq .err
movem.l (a7)+,d1/a0-a2
rts
.err move.l d1,d0
movem.l (a7)+,d1/a0-a2
move.l a0,-(a7) ;file name
move.l d0,-(a7) ;doserror
move.l #TDREASON_DOSREAD,-(a7)
move.l (_resload),-(a7)
add.l #resload_Abort,(a7)
rts
;--------------------------------
;stop the dance
_exit move.l #TDREASON_OK,-(a7)
bra _end
_debug move.l #TDREASON_DEBUG,-(a7)
_end move.l (_resload,pc),-(a7)
add.l #resload_Abort,(a7)
rts
;======================================================================
END